<title>文章编辑</title>
<style>
    input {
        border: none !important;
    }

    .layui-card {
        padding-left: 0 !important;
        margin-left: 0 !important;
    }

    .commentView-card {
        margin-top: 20px;
    }

</style>
<script type="text/html" template>
    <link rel="stylesheet" href="{{ layui.setter.base }}style/jw_admin.css?v={{ layui.admin.v }}-1" media="all">
</script>
<div class="layui-fluid" id="layuiadmin-form-comment" lay-filter="layuiadmin-form-comment">
    <script type="text/html" template lay-url="/api/admin/article/edit/detail/{{ d.params.oid }}"
            lay-done="doView(d);">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12 art-left">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <div>
                            <h1 style="font-weight: bold">{{ d.data.title }}</h1>
                        </div>
                        <span style="color: #aaa"> &nbsp;&nbsp;&nbsp;------ {{ d.data.author }}</span>
                    </div>
                </div>
                <div class="layui-card">
                    <div class="layui-card-header">
                        <span style="color: #aaa">{{ d.data.categoryName == null ? "" : ("类别: " + d.data.categoryName) }}</span>
                        <span style="color: #aaa">标签:</span>
                        {{# layui.each(d.data.artTagsList, function(index, item){ }}
                        <span style="color: #aaa">
                                 {{#  if(index !== 0){ }}
                                  ,
                                 {{#  } }}
                                {{ item.name}}
                            </span>
                        {{# }); }}
                    </div>
                </div>
                <div class="layui-card">
                    <div class="layui-card-body" id="article-content">
                        {{ d.data.content }}
                    </div>
                </div>

                <div class="layui-card commentView-card">
                    <div class="layui-card-body">
                        <!--                        comment-->
                        <div class="commentView" id="commentView"></div>
                    </div>
                </div>


            </div>
        </div>
    </script>

</div>

<script id="commentTemplate" type="text/html">

    <div class="comment-content ">
        {{# layui.each(d, function(index, comm){ }}
        <div class="comment-list">
            <div class="media-body">
                <a href="javascript:" class="media-left" style="float: left;">
                    <img src="{{ comm.avatarSrc }}" height="46px"
                         width="46px">
                </a>
                <div class="pad-btm">
                    <p class="fontColor">
                        <a href="javascript:">{{ comm.userName }}</a>
                    </p>
                    <p class="min-font">
                        <a href="javascript:" style="font-size: 12px">{{ comm.commentTimeDesc }}</a>
                    </p>
                </div>
                <p class="message-text">{{=comm.content}}</p>
            </div>
            <div class="comment-content-reply">
                {{# layui.each(comm.replyList, function(index, rep){ }}
                <div>
                    <div class="media-body">
                        <a href="javascript:" class="media-left" style="float: left;">
                            <img src="{{rep.avatarSrc}}" height="46px"
                                 width="46px">
                        </a>
                        <div class="pad-btm">
                            <p class="fontColor">
                                <a href="javascript:">{{rep.userName}}</a>
                                <a href="javascript:">回复 @{{rep.parentUserName}}</a>
                            </p>
                            <p class="min-font">
                                <a href="javascript:" style="font-size: 12px">{{rep.commentTimeDesc}}</a>
                            </p>
                        </div>
                        <p class="message-text">{{=rep.content}}</p>
                    </div>
                </div>
                {{# }); }}
            </div>
        </div>
        {{# }); }}
    </div>


</script>

<script>
    doView = function (d) {
        layui.use(['admin', 'form', 'table', 'element', 'laytpl', "comment"], function () {
            var $ = layui.jquery
                , form = layui.form
                , laytpl = layui.laytpl
                , element = layui.element;
            element.render()
            form.render()
            renderComm(d.data.id);
        })
    }


</script>